/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package controllerButtons;

import java.awt.Color;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import javax.swing.JLabel;
import javax.swing.JPanel;

/**
 *
 * @author luc0
 */
public class RoundControllerButton extends JPanel {

    private String label;                      // The Button's text
    private String buttonToPress;
    private Color color;
    private boolean repeatsPresses;
    private int timeBetweePresses;
    private JLabel moveLabel;
    /**
     * Constructs a RoundButton with no label.
     */
    public RoundControllerButton() {
        this("");
    }

    /**
     * Constructs a RoundButton with the specified label.
     * @param label the label of the button
     */
    public RoundControllerButton(String label) {
        this.label = label;
      
       
       
    }

    /**
     * gets the label
     * @see setLabel
     */
    public String getLabel() {
        return label;
    }

    /**
     * sets the label
     * @see getLabel
     */
    public void setLabel(String label) {
        this.label = label;
        invalidate();
        repaint();
    }

    public String getButtonToPress() {
        return buttonToPress;
    }

    public void setButtonToPress(String buttonToPress) {
        this.buttonToPress = buttonToPress;
    }

    public Color getColor() {
        return color;
    }

    public void setColor(Color color) {
        this.color = color;
    }

    public boolean isRepeatsPresses() {
        return repeatsPresses;
    }

    public void setRepeatsPresses(boolean repeatsPresses) {
        this.repeatsPresses = repeatsPresses;
    }

    

    /**
     * paints the RoundButton
     */
    @Override
    public void paint(Graphics g) {

        int s = Math.min(getSize().height - 1, getSize().height - 1);
        if(color != null){
            g.setColor(color);
        }else {
            g.setColor(Color.BLACK);
        }
        
        g.fillArc(0, 0, s, s, 0, 360);

        // draw the perimeter of the button
        g.drawArc(0, 0, s, s, 0, 360);

        // draw the label centered in the button
        Font f = getFont();
        if (f != null) {
            FontMetrics fm = getFontMetrics(getFont());
            g.setColor(Color.white);  //getForeground());
            g.drawString(label,
                    s / 2 - fm.stringWidth(label) / 2,
                    s / 2 + fm.getMaxDescent());
        }

        //Mouse anchor for move
         g.setColor(Color.RED);
         g.fillRect(0,0,10,10);
    }

    public int getTimeBetweePresses() {
        return timeBetweePresses;
    }

    public void setTimeBetweePresses(int timeBetweePresses) {
        this.timeBetweePresses = timeBetweePresses;
    }

    
}
